package admin.room.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

import com.room.domain.RoomCommand;

@Component
public class RoomDaoImpl extends SqlSessionDaoSupport implements RoomDao{

	@Override
	public List<RoomCommand> getRoomlist() {
		
		List<RoomCommand> list = getSqlSession().selectList("getRoomlist");
				
		return list;
	}

	@Override
	public RoomCommand getRoom(String id) {
		RoomCommand room = getSqlSession().selectOne("getRoom",id);
		return room;
	}

	@Override
	public List<RoomCommand> list(Map<String, Object> map) {
		List<RoomCommand> list = getSqlSession().selectList("RoomList",map);
		return list;
	}
	
	@Override
	public List<RoomCommand> list() {
		List<RoomCommand> list = getSqlSession().selectList("RoomList");
		return list;
	}

	@Override
	public void insert(RoomCommand room) {
		getSqlSession().insert("insertRoom",room);
	}

	@Override
	public RoomCommand selectRoom(String code) {
		RoomCommand command = (RoomCommand)getSqlSession().selectOne("selectRoom",code);
		return command;
	}


	@Override
	public void delete(String code) {
		getSqlSession().delete("deleteRoom",code);
	}

	@Override
	public Integer RoomDup(String code) {
		return getSqlSession().selectOne("RoomCount",code);
	}
	@Override
	public void update(RoomCommand room) {
		getSqlSession().update("updateRoom",room);
	}
	
}
